// @Name    : cai_base_http_user_configure
// @author  : simon
// @date    : 2023/10/26 16:31
// @version : 1.0
// @desc :
import 'cai_http_request.dart';
import 'package:shared_preferences/shared_preferences.dart';

class CaiBaseHttpUserConfigure {

  static Future<void> setToken(String token) async {
    final prefs = await SharedPreferences.getInstance();
    prefs.setString('http_token', token);
    await CaiHttpRequest.shared.changeConfig();
  }

  static Future<String?> getToken() async {
    final prefs = await SharedPreferences.getInstance();
    final value = prefs.getString('http_token');
    return value;
  }

  static Future<bool> removeToken() async {
    final prefs = await SharedPreferences.getInstance();
    final bool = prefs.remove('http_token');
    await CaiHttpRequest.shared.changeConfig();
    return bool;
  }
}
